package springmvcdemo.mapper;

import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import springmvcdemo.model.MessageInfo;

import java.util.List;

@Mapper
public interface MessageInfoMapper {
    @Insert("insert into message_info ( `from`,`to`,`message` ) values (#{from},#{to},#{message})")
    Integer insertMessageInfo(MessageInfo messageInfo);

    @Select("select * from message_info")
    List<MessageInfo> queryAllMessageInfo();

    @Delete("delete from message_info where id=#{id}")
    void deleteMessageInfoById(Integer id);

    @Select("select * from message_info where id=#{id}")
    MessageInfo query(Integer id);
}
